<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" charset="utf-8"></script>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <form action="#" class="login-form">
        <h1>Log In</h1>

        <div class="txtb">
            <input type="text">
            <span data-placeholder="Username"></span>
        </div>

        <div class="txtb">
            <input type="password">
            <span data-placeholder="Password"></span>
        </div>
        <input type="submit" class="logbtn" value="登录">

        <div class="bottom-text">
            Don't have account? <a href="#">Sign up</a>
        </div>
        
    </form>
    <script type="text/javascript">
        $(".txtb input").on("focus",function(){
            $(this).addClass("focus")
        })
        $(".txtb input").on("blur", function(){
                if($(this).val() == "")
                $(this).removeClass("focus");
            });       
    </script>
</body>
</html>